import type { PropType } from "vue";
import { PopoverInstance } from "@arco-design/web-vue";

export declare interface ILineData<T = any> {
  value?: string | number | Array<T>;
  span?: number;
  render?: (h: any, arg: any) => any;
  label?: string;
  labelIcon?: string; // 以svg-icon形式展示label
  limitType?: "text" | "number"; // 省略时显示数字形式还是文字形式
  labelWidth?: number;
  limit?: number;
  popover?: PopoverInstance; // a-popover属性
  popoverSlots?: {
    content?: () => HTMLElement;
    title?: () => HTMLElement;
  }; // a-popover插槽
}

export declare interface IPreview {
  data?: ILineData;
  pagination?: boolean;
  size?: number;
}

export const InfoLineProps = {
  labelWidth: {
    type: Number,
    default: 0,
  },
  labelPosition: {
    type: String,
    default: "left",
  },
  isEllipsis: {
    type: Boolean,
    default: false,
  },
  limit: {
    type: Number,
    default: 1,
  },
  lineData: {
    type: Object as PropType<ILineData>,
    default: () => ({}),
  },
  pagination: {
    type: Boolean,
    default: true,
  },
  pageSize: {
    type: Number,
    default: 50,
  },
};
